package com.wwc.business.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;

/**
 * 火车类型枚举
 */
@Getter
@AllArgsConstructor
@ToString
public enum TrainTypeEnum{
	G("G", "高铁", new BigDecimal("1.2")),
	D("D", "动车", new BigDecimal("1")),
	K("K", "快速", new BigDecimal("0.8"));

	private final String code;
	private final String desc;
	/**
	 * 票价比例，例：1.1，则票价 = 1.1 * 每公里单价（SeatTypeEnum.price） * 公里（station.km）
	 */
	private final BigDecimal priceRate;

	public static List<HashMap<String, String>> getEnumList(){
		List<HashMap<String, String>> list = new ArrayList<>();
		for(TrainTypeEnum anEnum : EnumSet.allOf(TrainTypeEnum.class)){
			HashMap<String, String> map = new HashMap<>();
			map.put("code", anEnum.code);
			map.put("desc", anEnum.desc);
			list.add(map);
		}
		return list;
	}
}
